﻿using ChurchDiary.DAL.Contract;
using ChurchDiary.DAL.Methods;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ChurchDiary.TableEntity;
using System.Data;
using ChurchDiary.Common;

namespace ChurchDiary.BLL
{
    public class Customer
    {
        public int CustomerID { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
    }
    public class BLL_Church
    {
        IDALChurch Ch = new DAL_ChurchDetails();
        public EntityChurchSammary GetChurchSummary()
        {
            return Ch.GetChurchSummary();
        }
        public string InsertChurchDetails(EntityChurch Church)
        {
            return Ch.InsertChurchDetails(Church);
        }
        public string UpdateChurchDetails(EntityChurch Church)
        {
            return Ch.UpdateChurchDetails(Church);
        }
        public List<EntityChurchDesignation> GetChurchDesignation()
        {
            return Ch.GetChurchDesignation();
        }
        public List<EntityChurch> GetChurches()
        {
            return Ch.GetChurches();
        }
        public EntityChurch GetChurch(Guid ChurchId)
        {
            IDALChurch CHD = new DAL_ChurchDetails();
            return CHD.GetChurch(ChurchId);
        }
        public List<EntityChurch> GetChurch(int PageNo, string SearchKey, string Sort, string SortMode, int PerPage, Guid PartitionId, Guid DesignationId)
        {
            IDALChurch CHD = new DAL_ChurchDetails();
            return CHD.GetChurch(PageNo, SearchKey, Sort, SortMode, PerPage, PartitionId, DesignationId);
        }
        public List<EntityChurch> PrintChurch(string SearchKey, string Sort, string SortMode, Guid PartitionId, Guid DesignationId)
        {
            IDALChurch CHD = new DAL_ChurchDetails();
            return CHD.PrintChurch(SearchKey, Sort, SortMode, PartitionId, DesignationId);
        }
        public List<EntityChurch> GetChurch()
        {
            IDALChurch CHD = new DAL_ChurchDetails();
            return CHD.GetChurch();
        }
        public string DeleteChurch(Guid ChurchId)
        {
            return Ch.DeleteChurch(ChurchId);
        }
        public List<EntityChurch> GetChurches(Guid Partitionid)
        {
            return Ch.GetChurches(Partitionid);
        }
        #region Designation
        public string InsertDesignation(EntityChurchDesignation Designation)
        {
            return Ch.InsertDesignation(Designation);
        }
        public string UpdateDesignation(EntityChurchDesignation Designation)
        {
            return Ch.UpdateDesignation(Designation);
        }
        public string DeleteDesignation(Guid DesignationId)
        {
            return Ch.DeleteDesignation(DesignationId);
        }
        public List<EntityChurchDesignation> GetDesignations()
        {
            return Ch.GetDesignations();
        }
        public List<EntityChurchDesignation> GetDesignations(int OrganizationId)
        {
            return Ch.GetDesignations(OrganizationId);
        }
        public EntityChurchDesignation GetDesignation(Guid DesignationId)
        {
            return Ch.GetDesignation(DesignationId);
        }
        public string GetDesignationList(List<EntityChurchDesignation> Designation)
        {
            StringBuilder sbDesignation = new StringBuilder();
            int i = 1;
            foreach (EntityChurchDesignation lst in Designation)
            {
                sbDesignation.Append("<tr class=\"even pointer\">");
                sbDesignation.Append("<td class=\"\">" + i + "</td>");
                sbDesignation.Append("<td class=\" \">" + lst.DesignationName + "</td>");
                sbDesignation.Append("<td class=\" \">" + lst.DesignationAbrivation + "</td>");
                sbDesignation.Append("<td class=\" \">" + lst.OrganizationName + "</td>");
                sbDesignation.Append("<td class=\" \">");
                sbDesignation.Append("<ul class=\"actionicons\">");
                sbDesignation.Append("<li><a data-id=" + lst.DesignationId + " data-toggle=\"tooltip\" class=\"del confirmbox\" data-placement=\"bottom\" title=\"\" data-original-title=\"Delete\"><i class=\"fa fa-trash\"></i></a></li>");
                sbDesignation.Append("<li><a data-id=" + lst.DesignationId + " data-toggle=\"tooltip\" class=\"edit\" data-placement=\"bottom\" title=\"\" data-original-title=\"Edit\"><i class=\"fa fa-pencil\"></i></a></li>");
                sbDesignation.Append("</ul>");
                sbDesignation.Append("</td>");
                sbDesignation.Append("</tr>");
                i += 1;
            }
            return sbDesignation.ToString();
        }
        public string GetDesignationOption(List<EntityChurchDesignation> Designation)
        {
            StringBuilder sbDesignation = new StringBuilder();
            sbDesignation.Append("<option value=\"\">Please Select</option>");
            foreach (EntityChurchDesignation lst in Designation)
            {
                sbDesignation.Append("<option value=" + lst.DesignationId + ">" + lst.DesignationName + "</option>");
            }
            return sbDesignation.ToString();
        }
        #endregion
        #region Reports
        public List<EntityChurchReport> GetChurchReport()
        {
           return Ch.GetChurchReport();
        }
        #endregion
        #region ChurchAsserts
        public string AddChurchAssert(EntityChurchAsserts ChurchAsserts)
        {
            return Ch.InsertChurchAsserts(ChurchAsserts);
        }
        public string UpdateChurchAssert(EntityChurchAsserts ChurchAsserts)
        {
            return Ch.UpdateChurchAsserts(ChurchAsserts);
        }
        public string DeleteChurchAsserts(Guid AssertId)
        {
            return Ch.DeleteChurchAsserts(AssertId);
        }
        public List<EntityChurchAsserts> GetChurchAsserts()
        {
            return Ch.GetChurchAsserts();
        }
        public EntityChurchAsserts GetChurchAsserts(Guid AssertId)
        {
            return Ch.GetChurchAsserts(AssertId);
        }
        public string GetChurchAssertsList(List<EntityChurchAsserts> ChurchAsserts)
        {
            StringBuilder sbChurchAsserts = new StringBuilder();
            int i = 1;
            foreach (EntityChurchAsserts lst in ChurchAsserts)
            {
                sbChurchAsserts.Append("<tr class=\"even pointer\">");
                sbChurchAsserts.Append("<td class=\" \">" + lst.NameOfAsserts + "</td>");
                sbChurchAsserts.Append("<td class=\" \">" + lst.TotalNumbers + "</td>");
                sbChurchAsserts.Append("<td class=\" \">" + lst.PriceAmount + "</td>");
                sbChurchAsserts.Append("<td class=\" \">" + lst.DateOfAsserts + "</td>");
                sbChurchAsserts.Append("<td class=\" \">");
                sbChurchAsserts.Append("<ul class=\"actionicons\">");
                sbChurchAsserts.Append("<li><a data-id=" + lst.ChurchAssertsId + " data-toggle=\"tooltip\" class=\"del confirmbox\" data-placement=\"bottom\" title=\"\" data-original-title=\"Delete\"><i class=\"fa fa-trash\"></i></a></li>");
                sbChurchAsserts.Append("<li><a data-id=" + lst.ChurchAssertsId + " data-toggle=\"tooltip\" class=\"edit\" data-placement=\"bottom\" title=\"\" data-original-title=\"Edit\"><i class=\"fa fa-pencil\"></i></a></li>");
                sbChurchAsserts.Append("<li><a href=\"../../Church/AddMembers/info?FamilyId=" + lst.ChurchAssertsId + "\" class=\"view\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"\" data-original-title=\"info\"><i class=\"fa fa-print\"></i></a></li>");
                sbChurchAsserts.Append("</ul>");
                sbChurchAsserts.Append("</td>");
                sbChurchAsserts.Append("</tr>");
                i += 1;
            }
            return sbChurchAsserts.ToString();
        }
        #endregion
        #region ChurchBoard
        public string AddChurchBoard(EntityChurchBoard ChurchBoard)
        {
            return Ch.InsertChurchBoard(ChurchBoard);
        }
        public string UpdateChurchBoard(EntityChurchBoard ChurchBoard)
        {
            return Ch.UpdateChurchBoard(ChurchBoard);
        }
        public string DeleteChurchBoard(Guid BoardId)
        {
            return Ch.DeleteChurchBoard(BoardId);
        }
        public List<EntityChurchBoard> GetChurchBoard()
        {
            return Ch.GetChurchBoard();
        }
        public EntityChurchBoard GetChurchBoard(Guid BoardId)
        {
            return Ch.GetChurchBoard(BoardId);
        }
        public string GetChurchBoardList(List<EntityChurchBoard> ChurchBoard)
        {
            StringBuilder sbChurchBoard = new StringBuilder();
            int i = 1;
            foreach (EntityChurchBoard lst in ChurchBoard)
            {
                sbChurchBoard.Append("<tr class=\"even pointer\">");
                sbChurchBoard.Append("<td class=\" \">" + lst.BoardName + "</td>");
                sbChurchBoard.Append("<td class=\" \">" + lst.BoardAbbrivation + "</td>");
                sbChurchBoard.Append("<td class=\" \">");
                sbChurchBoard.Append("<ul class=\"actionicons\">");
                sbChurchBoard.Append("<li><a data-id=" + lst.BoardId + " data-toggle=\"tooltip\" class=\"del confirmbox\" data-placement=\"bottom\" title=\"\" data-original-title=\"Delete\"><i class=\"fa fa-trash\"></i></a></li>");
                sbChurchBoard.Append("<li><a data-id=" + lst.BoardId + " data-toggle=\"tooltip\" class=\"edit\" data-placement=\"bottom\" title=\"\" data-original-title=\"Edit\"><i class=\"fa fa-pencil\"></i></a></li>");
                //sbChurchBoard.Append("<li><a href=\"../../Church/AddMembers/info?FamilyId=" + lst.ChurchAssertsId + "\" class=\"view\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"\" data-original-title=\"info\"><i class=\"fa fa-print\"></i></a></li>");
                sbChurchBoard.Append("</ul>");
                sbChurchBoard.Append("</td>");
                sbChurchBoard.Append("</tr>");
                i += 1;
            }
            return sbChurchBoard.ToString();
        }
        public string GetChurchBoardDropDown(List<EntityChurchBoard> ChurchBoard)
        {
            StringBuilder sbChurchBoard = new StringBuilder();
            sbChurchBoard.Append("<option value=''>Please Select</option>");
            foreach (EntityChurchBoard lst in ChurchBoard)
            {
                sbChurchBoard.Append("<option value=" + lst.BoardId + ">" + lst.BoardName + "</option>");
            }
            return sbChurchBoard.ToString();
        }
        #endregion
        #region ChurchBoard Jobtitle
        public string AddChurchBoardJobtitle(EntityChurchBoardJobtitle ChurchBoardJobtitle)
        {
            return Ch.InsertChurchBoardJobtitle(ChurchBoardJobtitle);
        }
        public string UpdateChurchBoardJobtitle(EntityChurchBoardJobtitle ChurchBoardJobtitle)
        {
            return Ch.UpdateChurchBoardJobtitle(ChurchBoardJobtitle);
        }
        public string DeleteChurchBoardJobtitle(Guid BoardJobtitleId)
        {
            return Ch.DeleteChurchBoardJobtitle(BoardJobtitleId);
        }
        public List<EntityChurchBoardJobtitle> GetChurchBoardJobtitle()
        {
            return Ch.GetChurchBoardJobtitle();
        }
        public List<EntityChurchBoardJobtitle> GetChurchBoardJobtitlebyBoardId(Guid BoardId)
        {
            return Ch.GetChurchBoardJobtitlebyBoardId(BoardId);
        }

        public List<EntityChurchBoardJobtitle> GetChurchBoardAssignedJobtitle(Guid BoardId)
        {
            return Ch.GetChurchBoardAssignedJobtitle(BoardId);
        }

        public List<EntityChurchBoardJobtitle> GetChurchBoardJobtitlebyRole(Guid BoardId)
        {
            return Ch.GetChurchBoardJobtitlebyRole(BoardId);
        }
        public EntityChurchBoardJobtitle GetChurchBoardJobtitle(Guid BoardJobtitleId)
        {
            return Ch.GetChurchBoardJobtitle(BoardJobtitleId);
        }
        public string GetChurchBoardJobtitleList(List<EntityChurchBoardJobtitle> ChurchBoardJobtitle)
        {
            StringBuilder sbChurchBoardJobtitle = new StringBuilder();
            int i = 1;
            foreach (EntityChurchBoardJobtitle lst in ChurchBoardJobtitle)
            {
                sbChurchBoardJobtitle.Append("<tr class=\"even pointer\">");
                sbChurchBoardJobtitle.Append("<td class=\" \">" + lst.JobtitleName + "</td>");
                sbChurchBoardJobtitle.Append("<td class=\" \">" + lst.ChurchBoard.BoardName + "</td>");
                sbChurchBoardJobtitle.Append("<td class=\" \">");
                sbChurchBoardJobtitle.Append("<ul class=\"actionicons\">");
                sbChurchBoardJobtitle.Append("<li><a data-id=" + lst.BoardJobtitleId + " data-toggle=\"tooltip\" class=\"del confirmbox\" data-placement=\"bottom\" title=\"\" data-original-title=\"Delete\"><i class=\"fa fa-trash\"></i></a></li>");
                sbChurchBoardJobtitle.Append("<li><a data-id=" + lst.BoardJobtitleId + " data-toggle=\"tooltip\" class=\"edit\" data-placement=\"bottom\" title=\"\" data-original-title=\"Edit\"><i class=\"fa fa-pencil\"></i></a></li>");
                //sbChurchBoard.Append("<li><a href=\"../../Church/AddMembers/info?FamilyId=" + lst.ChurchAssertsId + "\" class=\"view\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"\" data-original-title=\"info\"><i class=\"fa fa-print\"></i></a></li>");
                sbChurchBoardJobtitle.Append("</ul>");
                sbChurchBoardJobtitle.Append("</td>");
                sbChurchBoardJobtitle.Append("</tr>");
                i += 1;
            }
            return sbChurchBoardJobtitle.ToString();
        }
        public string GetChurchBoardJobtitleDropDown(List<EntityChurchBoardJobtitle> ChurchBoardJobtitle)
        {
            StringBuilder sbChurchBoardJobtitle = new StringBuilder();
            sbChurchBoardJobtitle.Append("<option value=''>Please Select</option>");
            foreach (EntityChurchBoardJobtitle lst in ChurchBoardJobtitle)
            {
                sbChurchBoardJobtitle.Append("<option value=" + lst.BoardJobtitleId + ">" + lst.JobtitleName + "</option>");
            }
            return sbChurchBoardJobtitle.ToString();
        }
        #endregion
        #region IncomeType
        public string InsertIncomeType(EntityIncomeType IncomeType)
        {
            return Ch.InsertIncomeType(IncomeType);
        }
        public string UpdateIncomeType(EntityIncomeType IncomeType)
        {
            return Ch.UpdateIncomeType(IncomeType);
        }
        public string DeleteIncomeType(Guid IncomeTypeId)
        {
            return Ch.DeleteIncomeType(IncomeTypeId);
        }
        public List<EntityIncomeType> GetIncomeType()
        {
            return Ch.GetIncomeType();
        }
        public EntityIncomeType GetIncomeType(Guid IncomeTypeId)
        {
            return Ch.GetIncomeType(IncomeTypeId);
        }
        public string GetIncomeTypeList(List<EntityIncomeType> IncomeType)
        {
            StringBuilder sbIncomeType = new StringBuilder();
            foreach (EntityIncomeType lst in IncomeType)
            {
                sbIncomeType.Append("<tr class=\"even pointer\">");
                sbIncomeType.Append("<td class=\" \">" + lst.IncomeTypeName + "</td>");
                if (lst.IncomeType == 1)
                {
                    sbIncomeType.Append("<td class=\" \">Regular</td>");
                }
                else
                {
                    sbIncomeType.Append("<td class=\" \">Short Term</td>");
                }
                sbIncomeType.Append("<td class=\" \">");
                sbIncomeType.Append("<ul class=\"actionicons\">");
                sbIncomeType.Append("<li><a data-id=" + lst.IncomeTypeId + " data-toggle=\"tooltip\" class=\"del confirmbox\" data-placement=\"bottom\" title=\"\" data-original-title=\"Delete\"><i class=\"fa fa-trash\"></i></a></li>");
                sbIncomeType.Append("<li><a data-id=" + lst.IncomeTypeId + " data-toggle=\"tooltip\" class=\"edit\" data-placement=\"bottom\" title=\"\" data-original-title=\"Edit\"><i class=\"fa fa-pencil\"></i></a></li>");
                //sbChurchBoard.Append("<li><a href=\"../../Church/AddMembers/info?FamilyId=" + lst.ChurchAssertsId + "\" class=\"view\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"\" data-original-title=\"info\"><i class=\"fa fa-print\"></i></a></li>");
                sbIncomeType.Append("</ul>");
                sbIncomeType.Append("</td>");
                sbIncomeType.Append("</tr>");
            }
            return sbIncomeType.ToString();
        }
        #endregion
        #region Jobtitle Role
        public string InsertJobtitleRole(EntityChurchJobtitleRole JobtitleRole)
        {
            return Ch.InsertJobtitleRole(JobtitleRole);
        }
        public string UpdateJobtitleRole(EntityChurchJobtitleRole JobtitleRole)
        {
            return Ch.UpdateJobtitleRole(JobtitleRole);
        }
        public string DeleteJobtitleRole(Guid JobtitleRoleId)
        {
            return Ch.DeleteJobtitleRole(JobtitleRoleId);
        }
        public List<EntityChurchJobtitleRole> GetJobtitleRole()
        {
            return Ch.GetJobtitleRole();
        }
        public EntityChurchJobtitleRole GetJobtitleRole(Guid JobtitleRoleId)
        {
            return Ch.GetJobtitleRole(JobtitleRoleId);
        }
        #endregion
        #region PrayerGroup
        public string InsertPrayerGroup(EntityPrayerGroup PrayerGroup)
        {
            return Ch.InsertPrayerGroup(PrayerGroup);
        }
        public string UpdatePrayerGroup(EntityPrayerGroup PrayerGroup)
        {
            return Ch.UpdatePrayerGroup(PrayerGroup);
        }
        public string DeletePrayerGroup(Guid PrayerGroupId)
        {
            return Ch.DeletePrayerGroup(PrayerGroupId);
        }
        public List<EntityPrayerGroup> GetPrayerGroup()
        {
            return Ch.GetPrayerGroup();
        }
        public EntityPrayerGroup GetPrayerGroup(Guid PrayerGroupId)
        {
            return Ch.GetPrayerGroup(PrayerGroupId);
        }
        #endregion
        
    }
}
